﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<script type="text/javascript" language="javascript">
    function confreg() {
        if (confirm("Зарегистрировать пациента?"))   window.open("/Client/Create")
    }
</script>
<center>
    <h2>
        Карта записи к специалисту c
        <%=ViewData["date_begin"]%>
        по
        <%=ViewData["date_end"]%>
        &nbsp&nbsp&nbsp
    </h2>
</center>
<center>
    <%=Ajax.ActionLink("На предыдущую неделю", "GetBigTable", new
{
    proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
    spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist,
    d = (((DateTime)ViewData["date_begin"]) - new TimeSpan(2, 0, 0, 0))
}, new AjaxOptions { UpdateTargetId = "bigtable" }, new {@class="g-button" })%>
&nbsp&nbsp&nbsp
    <%=Ajax.ActionLink("На следующую неделю", "GetBigTable", new
{
    proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
    spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist,
    d = (((DateTime)ViewData["date_end"]) + new TimeSpan(2, 0, 0, 0))
}, new AjaxOptions { UpdateTargetId = "bigtable" }, new { @class = "g-button" })%>
</center>
 <table id="maintable">
 <tr>
 <th>Время</th>
 <th>Понедельник<br /><%=((DateTime)ViewData["date_begin"]).ToShortDateString() %></th>
  <th>Вторник<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(1, 0, 0, 0)).ToShortDateString() %></th>
 <th>Среда<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(2, 0, 0, 0)).ToShortDateString() %></th>
 <th>Четверг<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(3, 0, 0, 0)).ToShortDateString() %></th>
 <th>Пятница<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(4, 0, 0, 0)).ToShortDateString() %></th>
 <th>Суббота<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(5, 0, 0, 0)).ToShortDateString() %></th>
 <th>Воскресенье<br /><%=(((DateTime)ViewData["date_begin"]) + new TimeSpan(6, 0, 0, 0)).ToShortDateString() %></th>
 </tr>
 <% for (int i = 0; i < 26; i++)
    { %>
    <tr>
    <td><%= (new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString()%></td>
    <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[0][i]==0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(0,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

    
    <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[1][i]==0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new
{
    date = ((DateTime)ViewData["date_begin"]) + new TimeSpan(1, 0, 0, 0),
    time = (new TimeSpan(8, 0, 0) + new TimeSpan(0, 30 * i, 0)).ToString(),
    proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
    spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist
},
                new AjaxOptions { UpdateTargetId = "findp" }, new { @class="m-button"})
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

     <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[2][i] == 0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(2,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

     <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[3][i] == 0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(3,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

     <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[4][i] == 0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(4,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

     <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[5][i] == 0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(5,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

     <%if (((ElectronicRecords.Models.ViewRequestMap)ViewData["maps"]).Days[6][i] == 0)
      { %>
      <td style="background-color:#99FFCC">
       <%=Ajax.ActionLink("Записать", "CreateRequest", new {
                date=((DateTime)ViewData["date_begin"])+new TimeSpan(6,0,0,0),
                time=(new TimeSpan(8,0,0)+new TimeSpan(0,30*i,0)).ToString(),
                proc = (ViewData["procid"] as ElectronicRecords.Models.Procedurs).ID_Procedure,
                spec = (ViewData["specid"] as ElectronicRecords.Models.Specialists).ID_Specialist},
                           new AjaxOptions { UpdateTargetId = "findp" }, new { @class = "m-button" })
        %>
       </td>
    <%} %>
    <%else
        { %>
          <td style="background-color:#FFB3BE"></td>
    <%} %>

    </tr>
 <%} %>
 </table>
 <div id="findp"></div>
